Word of warning (for upcoming assignments)

I don’t want to see exact replicates of this document. Here, you will note that I am “riffing”, exploring potential ways to represent the information and discussing this. In your assignments, this is not something you would typically do. Explain what you are doing, but get to the point, don’t “riff” around without a purpose.

Load the data

We load two data files: air_travel_MB.csv contains the network description and airport_codes_CAN.csv, which has some information about all airfields in Canada.

The data in air_travel_MB is pre-processed. It represents an extreme simplification of a much more complete dataset giving, for a given time period, the total number of travellers between 3734 airports worldwide along trips including up to 5 intermediate stops.

What I did is to keep only the airports in Manitoba. Any airport outside of Manitoba is set as RoW (rest of the world). Also, the existing multi-leg trips within Manitoba are “decomposed”: if the data had 10 people flying, say, YWG\(\to\)YQD\(\to\)YTH (Winnipeg to The Pas to Thompson), these would appear as 10 people flying from YWG to YQD and 10 people flying from YQD to YTH.

Flights to and from RoW are decomposed the same way as flights within Manitoba, increasing the number of trips between RoW and YWG. Indeed, 5 passengers flying RoW\(\to\)YWG\(\to\)YQD and 5 passengers flying RoW\(\to\)YWG\(\to\)YBR (Brandon) will show as 10 passengers flying RoW to YWG, together with 5 passengers flying YWG\(\to\)YQD and 5 passengers flying YWG\(\to\)YBR.

First, here is what the flight data looks like. (I am using knitr::kable to make the table more readable.)

orig dest vol
RoW YBR 2002
RoW YTH 18
RoW YWG 157323
RoW YYQ 1474
XLB RoW 766
XLB XTL 114

The airport data, filtered to only retain MB locations, looks as follows.

Airport_ID Identifier Type Name Latitude Longitude Elevation_Ft Continent ISO_Country_Code ISO_Region Municipality Is_Scheduled_Service GPS_Code IATA_Code Local_Code Home_Link Wikipedia_Link Keywords
35391 CA-0006 closed RCAF Station Carberry 49.87210 -99.39730 NA NA CA CA-MB Carberry FALSE NA NA NA NA https://en.wikipedia.org/wiki/RCAF_Station_Carberry NA
39668 CA-0022 closed Anama Bay-Dauphin River Airport 51.96267 -98.13684 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39677 CA-0031 closed Austin Airport 49.93333 -98.91666 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39686 CA-0040 closed Beausejour Airport 50.13697 -96.20822 NA NA CA CA-MB Beausejour FALSE NA NA NA NA NA NA
39694 CA-0048 closed Bethany Airport 50.35000 -99.75000 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39696 CA-0050 closed Bird Airport 56.50000 -94.21667 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39698 CA-0052 closed Wallace Lake Airport 51.00835 -95.42192 NA NA CA CA-MB Bissett FALSE NA NA NA NA NA NA
39728 CA-0082 closed Carberry Airport 49.85000 -99.31667 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39745 CA-0099 closed Cormorant Lake Airport 54.23333 -100.60000 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39749 CA-0103 closed Crater Airport 49.91667 -99.80000 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39790 CA-0144 closed Gladstone (Costella Field) Airport 50.20000 -99.05000 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39802 CA-0156 closed Hartney Airport 49.45000 -100.51667 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39803 CA-0157 closed Haskett Airport 49.00000 -97.90000 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39824 CA-0178 small_airport Kaskattama Airstrip 57.04150 -90.11260 30 NA CA CA-MB Kaska Goose Lodge FALSE NA NA NA NA NA NA
39887 CA-0241 closed Moose Lake Airport 53.70626 -100.34397 NA NA CA CA-MB NA FALSE NA YAD CJB4 NA NA NA
39902 CA-0256 closed Nanook Airport 57.13334 -91.61667 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39923 CA-0277 closed Paulson Airport 51.13334 -99.86667 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39931 CA-0285 closed Petrel Airport 49.96667 -99.35000 NA NA CA CA-MB NA FALSE NA NA NA NA NA NA
39933 CA-0287 closed Pineimuta Municipal Airport 51.67073 -98.74032 855 NA CA CA-MB Pineimuta FALSE NA NA JA2 NA NA NA
39959 CA-0313 closed Rivers Airport 50.01006 -100.31393 1550 NA CA CA-MB NA FALSE NA YYI NA NA NA CYYI
40062 CA-0416 small_airport Wrong Lake Airport 52.61545 -96.18402 840 NA CA CA-MB NA FALSE CJG4 NA CJG4 NA https://en.wikipedia.org/wiki/Wrong_Lake_Airport NA
320526 CA-0628 closed Little Grand Rapids Water Aerodrome 52.03600 -95.47000 965 NA CA CA-MB Little Grand Rapids FALSE NA NA KB3 NA NA NA
325172 CA-0699 small_airport Bolton Lake Lodge Airstrip 54.22066 -95.76659 719 NA CA CA-MB Bolton Lake FALSE NA NA NA http://www.boltonlake.com/ NA NA
45222 CAV6 small_airport Beausejour/Av-Ranch Airpark 50.04111 -96.58583 800 NA CA CA-MB NA FALSE CAV6 NA CAV6 NA NA NA
651 CAV9 small_airport Oak Hammock Air Park 50.13780 -97.06140 755 NA CA CA-MB Oak Hammock FALSE CAV9 NA CAV9 NA https://en.wikipedia.org/wiki/Oak_Hammock_Air_Park_Airport AV9
320122 CCS2 heliport Consort Health Centre Helipad 52.00910 -110.78200 2467 NA CA CA-MB Consort FALSE CCS2 NA CCS2 NA NA NA
854 CEG8 small_airport North Seal River Airport 58.96940 -99.97500 980 NA CA CA-MB North Seal River FALSE CEG8 NA CEG8 NA https://en.wikipedia.org/wiki/North_Seal_River_Airport EG8
28167 CFF8 seaplane_base Bakers Narrows Seaplane Base 54.67860 -101.66000 965 NA CA CA-MB Flin Flon FALSE CFF8 NA CFF8 NA https://en.wikipedia.org/wiki/Flin_Flon/Bakers_Narrows_Water_Aerodrome NA
320215 CHB2 heliport Hudson Bay Helicopters Heliport 58.76640 -94.16770 20 NA CA CA-MB Churchill FALSE CHB2 NA CHB2 http://hudsonbayheli.com/ NA NA
1045 CJA3 small_airport Morden Airport 49.21030 -98.05920 950 NA CA CA-MB Morden FALSE CJA3 NA CJA3 NA https://en.wikipedia.org/wiki/Morden_Airport JA3
1048 CJB2 small_airport Friendship Field 49.49140 -98.01860 882 NA CA CA-MB Carman FALSE CJB2 NA CJB2 NA https://en.wikipedia.org/wiki/Carman/Friendship_Field_Airport JB2
1049 CJB3 small_airport Steinbach Airport 49.54940 -96.67940 850 NA CA CA-MB Steinbach FALSE CJB3 NA CJB3 NA https://en.wikipedia.org/wiki/Steinbach_Airport JB3
1051 CJB6 small_airport Gods Lake Airport 54.77920 -93.71690 605 NA CA CA-MB Gods Lake FALSE CJB6 NA CJB6 NA https://en.wikipedia.org/wiki/Gods_Lake_Airport JB6
1058 CJC8 small_airport Laurie River Airport 56.24860 -101.30400 1200 NA CA CA-MB Laurie River FALSE CJC8 LRQ CJC8 NA https://en.wikipedia.org/wiki/Laurie_River_Airport JC8
1065 CJE4 small_airport Snow Lake Airport 54.89720 -99.81890 993 NA CA CA-MB Snow Lake FALSE CJE4 NA CJE4 NA https://en.wikipedia.org/wiki/Snow_Lake_Airport JE4
1068 CJE7 small_airport Ashern Airport 51.15860 -98.33190 976 NA CA CA-MB Ashern FALSE CJE7 NA CJE7 NA https://en.wikipedia.org/wiki/Ashern_Airport JE7
1074 CJH2 small_airport Gilbert Plains Airport 51.13330 -100.50000 1310 NA CA CA-MB Gilbert Plains FALSE CJH2 NA CJH2 NA https://en.wikipedia.org/wiki/Gilbert_Plains_Airport JH2
1079 CJJ2 small_airport Glenboro Airport 49.55000 -99.33330 1240 NA CA CA-MB Glenboro FALSE CJJ2 NA CJJ2 NA https://en.wikipedia.org/wiki/Glenboro_Airport JJ2
1080 CJJ4 small_airport Deloraine Airport 49.15060 -100.50100 1680 NA CA CA-MB Deloraine FALSE CJJ4 NA CJJ4 NA https://en.wikipedia.org/wiki/Deloraine_Airport JJ4
28192 CJJ7 seaplane_base Churchill Seaplane Base 58.70000 -94.05000 46 NA CA CA-MB Churchill FALSE CJJ7 NA CJJ7 NA https://en.wikipedia.org/wiki/Churchill_Water_Aerodrome JJ7
1083 CJK2 small_airport Gunisao Lake Airport 53.52000 -96.37110 886 NA CA CA-MB Gunisao Lake FALSE CJK2 NA CJK2 NA https://en.wikipedia.org/wiki/Gunisao_Lake_Airport JK2
28221 CJK8 seaplane_base Flin Flon/Channing Seaplane Base 54.74641 -101.82800 957 NA CA CA-MB Flin Flon FALSE CJK8 NA CJK8 NA https://en.wikipedia.org/wiki/Flin_Flon/Channing_Water_Aerodrome JK8
1090 CJL5 small_airport Winnipeg / Lyncrest Airport 49.85250 -96.97360 775 NA CA CA-MB Winnipeg FALSE CJL5 NA CJL5 NA https://en.wikipedia.org/wiki/Winnipeg/Lyncrest_Airport JL5
1091 CJL6 small_airport Altona Municipal Airport 49.09440 -97.53390 806 NA CA CA-MB Altona FALSE CJL6 NA CJL6 NA https://en.wikipedia.org/wiki/Altona_Municipal_Airport JL6
1102 CJN7 small_airport Little Churchill River / Dunlop’s Fly-In Lodge Airport 56.58000 -96.24750 700 NA CA CA-MB Little Churchill River FALSE CJN7 NA CJN7 NA https://en.wikipedia.org/wiki/Little_Churchill_River_Airport JN7
1105 CJP7 small_airport Bird River (Lac Du Bonnet) Airport 50.39670 -95.73500 950 NA CA CA-MB Bird River FALSE CJP7 NA CJP7 NA https://en.wikipedia.org/wiki/Bird_River_(Lac_du_Bonnet)_Airport JP7
28239 CJP8 seaplane_base Gillam Seaplane Base 56.35440 -94.65640 470 NA CA CA-MB NA FALSE CJP8 NA CJP8 NA https://en.wikipedia.org/wiki/Gillam_Water_Aerodrome JP8
1110 CJQ5 closed Arnes Airport 50.83610 -96.95720 725 NA CA CA-MB Arnes FALSE NA NA NA NA https://en.wikipedia.org/wiki/Arnes_Airport YNR, JQ5, CJQ5
1112 CJQ9 small_airport Big Sand Lake Airport 57.61940 -99.87530 1050 NA CA CA-MB Big Sand Lake FALSE CJQ9 NA CJQ9 NA https://en.wikipedia.org/wiki/Big_Sand_Lake_Airport JQ9
1114 CJR3 small_airport The Pas / Grace Lake Airport 53.82640 -101.20500 873 NA CA CA-MB The Pas FALSE CJR3 NA CJR3 NA https://en.wikipedia.org/wiki/The_Pas/Grace_Lake_Airport JR3
1116 CJR5 small_airport Gladstone Airport 50.16360 -98.94250 900 NA CA CA-MB Gladstone FALSE CJR5 NA CJR5 NA https://en.wikipedia.org/wiki/Gladstone_Airport JR5
1118 CJR8 small_airport Mccreary Airport 50.76470 -99.49670 1000 NA CA CA-MB Mccreary FALSE CJR8 NA CJR8 NA https://en.wikipedia.org/wiki/McCreary_Airport JR8
1123 CJS5 small_airport Killarney Municipal Airport 49.15170 -99.69030 1680 NA CA CA-MB Killarney FALSE CJS5 NA CJS5 NA https://en.wikipedia.org/wiki/Killarney_Municipal_Airport JS5
1124 CJS7 small_airport Carman (South) Airport 49.48030 -98.01500 870 NA CA CA-MB Carman FALSE CJS7 NA CJS7 NA https://en.wikipedia.org/wiki/Carman_(South)_Airport JS7
28240 CJS8 seaplane_base Gods Lake Narrows Seaplane Base 54.55000 -94.46670 595 NA CA CA-MB NA FALSE CJS8 NA CJS8 NA NA NA
28282 CJS9 seaplane_base Lac Du Bonnet (North) Seaplane Base 50.28330 -96.00000 836 NA CA CA-MB NA FALSE CJS9 NA CJS9 NA NA NA
1125 CJT2 small_airport Matheson Island Airport 51.73220 -96.93440 725 NA CA CA-MB Matheson Island FALSE CJT2 NA CJT2 NA https://en.wikipedia.org/wiki/Matheson_Island_Airport JT2
1126 CJT3 small_airport Knee Lake Airport 54.91530 -94.79810 625 NA CA CA-MB Knee Lake FALSE CJT3 YKE CJT3 NA https://en.wikipedia.org/wiki/Knee_Lake_Airport JT3
1128 CJT5 small_airport Melita Airport 49.26170 -101.01400 1475 NA CA CA-MB Melita FALSE CJT5 NA CJT5 NA https://en.wikipedia.org/wiki/Melita_Airport JT5
1129 CJT8 small_airport Homewood Airport 49.50920 -97.85060 815 NA CA CA-MB Homewood FALSE CJT8 NA CJT8 NA https://en.wikipedia.org/wiki/Homewood_Airport JT8
1131 CJU3 small_airport Macdonald Airport 50.09640 -98.50080 840 NA CA CA-MB Macdonald FALSE CJU3 NA CJU3 NA https://en.wikipedia.org/wiki/Macdonald_Airport JU3
1133 CJU5 small_airport Minnedosa Airport 50.27190 -99.76310 1840 NA CA CA-MB Minnedosa FALSE CJU5 NA CJU5 NA https://en.wikipedia.org/wiki/Minnedosa_Airport JU5
1134 CJU6 small_airport Arborg Airport 50.91280 -97.30440 765 NA CA CA-MB Arborg FALSE CJU6 NA CJU6 NA https://en.wikipedia.org/wiki/Arborg_Airport JU6
1138 CJV5 small_airport Neepawa Airport 50.23280 -99.51060 1277 NA CA CA-MB Neepawa FALSE CJV5 NA CJV5 NA https://en.wikipedia.org/wiki/Neepawa_Airport JV5
1140 CJV8 small_airport Grand Rapids Airport 53.17250 -99.32310 860 NA CA CA-MB Grand Rapids FALSE CJV8 NA CJV8 NA https://en.wikipedia.org/wiki/Grand_Rapids_Airport JV8
1145 CJW5 small_airport Russell Airport 50.76580 -101.29500 1825 NA CA CA-MB Russell FALSE CJW5 NA CJW5 NA https://en.wikipedia.org/wiki/Russell_Airport JW5
28248 CJW8 seaplane_base Gunisao Lake Seaplane Base 53.51670 -96.36670 866 NA CA CA-MB NA FALSE CJW8 NA CJW8 NA NA NA
1149 CJX5 small_airport Souris Glenwood Industrial Air Park 49.63330 -100.20000 1480 NA CA CA-MB Souris Glenwood FALSE CJX5 NA CJX5 NA https://en.wikipedia.org/wiki/Souris_Glenwood_Industrial_Air_Park JX5
28179 CJX6 seaplane_base Bird River Seaplane Base 50.40000 -95.75000 826 NA CA CA-MB NA FALSE CJX6 NA CJX6 NA NA NA
1153 CJY5 small_airport Strathclair Airport 50.39610 -100.42500 1875 NA CA CA-MB Strathclair FALSE CJY5 NA CJY5 NA https://en.wikipedia.org/wiki/Strathclair_Airport JY5
28180 CJY6 seaplane_base Bissett Seaplane Base 51.01670 -95.68330 824 NA CA CA-MB NA FALSE CJY6 NA CJY6 NA NA NA
1154 CJZ2 small_airport Portage La Prairie (North) Airport 49.99250 -98.30310 860 NA CA CA-MB Portage La Prairie FALSE CJZ2 NA CJZ2 NA https://en.wikipedia.org/wiki/Portage_La_Prairie_(North)_Airport JZ2
1157 CJZ5 closed Virden (West) Airport 49.88330 -101.06700 1510 NA CA CA-MB Virden FALSE CJZ5 NA CJZ5 NA https://en.wikipedia.org/wiki/Virden_(West)_Airport JZ5
28303 CKA3 seaplane_base Leaf Rapids Seaplane Base 56.55000 -99.93330 849 NA CA CA-MB NA FALSE CKA3 NA CKA3 NA NA NA
1158 CKA4 small_airport Zhoda Airport 49.28080 -96.50110 950 NA CA CA-MB Zhoda FALSE CKA4 NA CKA4 NA https://en.wikipedia.org/wiki/Zhoda_Airport KA4
1159 CKA8 small_airport St. François Xavier Airport 49.92440 -97.54890 798 NA CA CA-MB St. François Xavier FALSE CKA8 NA CKA8 NA https://en.wikipedia.org/wiki/St._Fran%C3%A7ois_Xavier_Airport KA8
1163 CKB7 small_airport Roblin Airport 51.23440 -101.39300 1821 NA CA CA-MB Roblin FALSE CKB7 NA CKB7 NA https://en.wikipedia.org/wiki/Roblin_Airport KB7
1164 CKB8 small_airport Silver Falls Airport 50.50000 -96.09810 775 NA CA CA-MB Silver Falls FALSE CKB8 NA CKB8 NA https://en.wikipedia.org/wiki/Silver_Falls_Airport KB8
28415 CKB9 seaplane_base Shoal Lake Seaplane Base 50.43330 -100.60000 NA NA CA CA-MB NA FALSE CKB9 NA CKB9 NA NA NA
28441 CKC3 seaplane_base The Pas / Grace Lake Seaplane Base 53.82072 -101.19267 855 NA CA CA-MB NA FALSE CKC3 NA CKC3 NA NA NA
28412 CKC5 seaplane_base Selkirk Seaplane Base 50.16670 -96.86670 735 NA CA CA-MB NA FALSE CKC5 NA CKC5 NA NA NA
1167 CKC8 small_airport Somerset Airport 49.40030 -98.69250 1563 NA CA CA-MB Somerset FALSE CKC8 NA CKC8 NA https://en.wikipedia.org/wiki/Somerset_Airport_(Manitoba) KC8
28306 CKD3 seaplane_base Lynn Lake (Eldon Lake) Seaplane Base 56.81720 -101.01900 1100 NA CA CA-MB NA FALSE CKD3 NA CKD3 NA NA NA
28442 CKD6 seaplane_base Thompson Seaplane Base 55.75000 -97.83330 596 NA CA CA-MB NA FALSE CKD6 NA CKD6 NA NA NA
1171 CKD7 small_airport Roland (Graham Field) Airport 49.40830 -97.99060 865 NA CA CA-MB Roland FALSE CKD7 NA CKD7 NA https://en.wikipedia.org/wiki/Roland_(Graham_Field)_Airport KD7
1179 CKF6 small_airport Macgregor Airport 49.96670 -98.75000 950 NA CA CA-MB Macgregor FALSE CKF6 NA CKF6 NA https://en.wikipedia.org/wiki/MacGregor_Airport KF6
1182 CKG2 small_airport Riverton Airport 50.97170 -97.01110 725 NA CA CA-MB Riverton FALSE CKG2 NA CKG2 NA https://en.wikipedia.org/wiki/Riverton_Airport KG2
1183 CKG5 small_airport Manitou Airport 49.25000 -98.53330 1592 NA CA CA-MB Manitou FALSE CKG5 NA CKG5 NA https://en.wikipedia.org/wiki/Manitou_Airport KG5
1189 CKJ2 small_airport Rosenort Airport 49.45310 -97.42250 779 NA CA CA-MB Rosenort FALSE CKJ2 NA CKJ2 NA https://en.wikipedia.org/wiki/Rosenort_Airport KJ2
28316 CKJ3 seaplane_base Mcgavock Lake Seaplane Base 56.56670 -101.50000 1100 NA CA CA-MB NA FALSE CKJ3 NA CKJ3 NA NA NA
28416 CKJ5 seaplane_base Silver Falls Seaplane Base 50.50000 -96.10000 755 NA CA CA-MB NA FALSE CKJ5 NA CKJ5 NA NA NA
1191 CKJ7 small_airport Starbuck Airport 49.71670 -97.68330 785 NA CA CA-MB Starbuck FALSE CKJ7 NA CKJ7 NA https://en.wikipedia.org/wiki/Starbuck_Airport KJ7
1192 CKJ8 small_airport Molson Lake Airport 54.25810 -97.01110 750 NA CA CA-MB Molson Lake FALSE CKJ8 NA CKJ8 NA https://en.wikipedia.org/wiki/Molson_Lake_Airport KJ8
28460 CKK6 seaplane_base Wabowden Seaplane Base 54.91670 -98.61670 744 NA CA CA-MB NA FALSE CKK6 NA CKK6 NA NA NA
1198 CKK7 small_airport Steinbach (South) Airport 49.49390 -96.69890 888 NA CA CA-MB Steinbach FALSE CKK7 NA CKK7 NA https://en.wikipedia.org/wiki/Steinbach_(South)_Airport KK7
1199 CKL2 small_airport Selkirk Airport 50.17220 -96.87220 747 NA CA CA-MB Selkirk FALSE CKL2 NA CKL2 NA https://en.wikipedia.org/wiki/Selkirk_Airport KL2
1202 CKL5 small_airport Shoal Lake Airport 50.45750 -100.60900 1836 NA CA CA-MB Shoal Lake FALSE CKL5 NA CKL5 NA https://en.wikipedia.org/wiki/Shoal_Lake_Airport KL5
1207 CKM3 heliport Shilo Heliport 49.80000 -99.63330 1225 NA CA CA-MB Shilo FALSE CKM3 NA CKM3 NA NA KM3
28421 CKM5 seaplane_base Snow Lake Seaplane Base 54.88330 -100.03300 890 NA CA CA-MB NA FALSE CKM5 NA CKM5 NA https://en.wikipedia.org/wiki/Snow_Lake_Water_Aerodrome KM5
1209 CKM6 small_airport Easterville Airport 53.11670 -99.80000 850 NA CA CA-MB Easterville FALSE CKM6 NA CKM6 NA https://en.wikipedia.org/wiki/Easterville_Airport KM6
1210 CKM7 heliport Thompson Heliport 55.70742 -97.89124 702 NA CA CA-MB Thompson FALSE CKM7 NA CKM7 NA NA KM7
1215 CKN9 heliport Shilo (Flewin Field) Heliport 49.78080 -99.63890 1223 NA CA CA-MB Shilo FALSE CKN9 NA CKN9 NA NA KN9
28387 CKP4 closed Pukatawagan Seaplane Base 55.73670 -101.32700 898 NA CA CA-MB Pukatawagan FALSE NA NA KP4 NA NA NA
1220 CKQ6 small_airport Erickson Municipal Airport 50.49940 -99.89780 2114 NA CA CA-MB Erickson FALSE CKQ6 NA CKQ6 NA https://en.wikipedia.org/wiki/Erickson_Municipal_Airport KQ6
1223 CKQ9 small_airport Pine Dock Airport 51.62000 -96.81080 750 NA CA CA-MB Pine Dock FALSE CKQ9 NA CKQ9 NA https://en.wikipedia.org/wiki/Pine_Dock_Airport KQ9
1224 CKR3 small_airport Ste. Rose Du Lac Airport 51.04080 -99.49530 900 NA CA CA-MB Ste. Rose Du Lac FALSE CKR3 NA CKR3 NA https://en.wikipedia.org/wiki/Ste._Rose_Du_Lac_Airport KR3
1225 CKR4 small_airport Lundar Airport 50.70330 -98.05670 830 NA CA CA-MB Lundar FALSE CKR4 NA CKR4 NA https://en.wikipedia.org/wiki/Lundar_Airport KR4
1227 CKR7 small_airport Virden (Gabrielle Farm) Airport 49.78470 -100.95600 1440 NA CA CA-MB Virden FALSE CKR7 NA CKR7 NA https://en.wikipedia.org/wiki/Virden_(Gabrielle_Farm)_Airport KR7
1234 CKT2 closed Thompson (Canadian Helicopters) Heliport 55.76670 -97.81670 630 NA CA CA-MB Thompson FALSE CKT2 NA CKT2 NA NA KT2
28393 CKT4 seaplane_base Red Sucker Lake Seaplane Base 54.15470 -93.56330 720 NA CA CA-MB NA FALSE CKT4 NA CKT4 NA NA NA
1235 CKT5 small_airport Hartney Airport 49.45000 -100.55000 1450 NA CA CA-MB Hartney FALSE CKT5 NA CKT5 NA https://en.wikipedia.org/wiki/Hartney_Airport KT5
28369 CKT8 seaplane_base Pine Dock Seaplane Base 51.61080 -96.81720 712 NA CA CA-MB NA FALSE CKT8 NA CKT8 NA NA NA
1237 CKU2 small_airport Treherne Airport 49.63110 -98.66640 1200 NA CA CA-MB Treherne FALSE CKU2 NA CKU2 NA https://en.wikipedia.org/wiki/Treherne_Airport KU2
28275 CKW8 seaplane_base Knee Lake Seaplane Base 54.89080 -94.80750 577 NA CA CA-MB NA FALSE CKW8 NA CKW8 NA NA NA
1251 CKX2 closed Warren / Woodlands Airport 50.15940 -97.59110 817 NA CA CA-MB Warren FALSE NA NA NA NA https://en.wikipedia.org/wiki/Warren/Woodlands_Airport KX2, CKX2
1253 CKX4 small_airport Fisher Branch Airport 51.08330 -97.48330 825 NA CA CA-MB Fisher Branch FALSE CKX4 NA CKX4 NA https://en.wikipedia.org/wiki/Fisher_Branch_Airport KX4
28344 CKY3 seaplane_base Norway House Seaplane Base 53.98530 -97.79390 712 NA CA CA-MB NA FALSE CKY3 NA CKY3 NA NA NA
1260 CKZ3 small_airport Elk Island Airport 54.67140 -94.14530 625 NA CA CA-MB Elk Island FALSE CKZ3 NA CKZ3 NA https://en.wikipedia.org/wiki/Elk_Island_Airport KZ3
1261 CKZ6 small_airport Louise Municipal Airport 49.14720 -98.88080 1525 NA CA CA-MB Crystal City-Pilot Mound FALSE CKZ6 NA CKZ6 NA https://en.wikipedia.org/wiki/Crystal_City-Pilot_Mound/Louise_Municipal_Airport KZ6
1262 CKZ7 small_airport Winkler Airport 49.16690 -97.92030 850 NA CA CA-MB Winkler FALSE CKZ7 NA CKZ7 NA https://en.wikipedia.org/wiki/Winkler_Airport KZ7
1320 CNL9 small_airport Nueltin Lake Airport 59.70810 -100.12700 971 NA CA CA-MB Nueltin Lake FALSE CNL9 NA CNL9 NA https://en.wikipedia.org/wiki/Nueltin_Lake_Airport NL9
320680 CPJ6 small_airport St-Pierre-Jolys (Carl’s Field) 49.43600 -96.92700 828 NA CA CA-MB St-Pierre-Jolys FALSE CPJ6 NA CPJ6 NA https://en.wikipedia.org/wiki/St-Pierre-Jolys_(Carl%27s_Field)_Aerodrome NA
1493 CRM2 small_airport Riding Mountain Airport 50.57360 -99.36140 1016 NA CA CA-MB Riding Mountain FALSE CRM2 NA CRM2 NA https://en.wikipedia.org/wiki/Riding_Mountain_Airport RM2
1495 CRP2 small_airport R.M. of Pipestone Airport 49.58060 -101.05300 1488 NA CA CA-MB Reston FALSE CRP2 NA CRP2 NA https://en.wikipedia.org/wiki/Reston/R.M._of_Pipestone_Airport RP2
1606 CTN6 small_airport Treherne (South Norfolk Airpark) Airport 49.65970 -98.66530 1190 NA CA CA-MB Treherne FALSE CTN6 NA CTN6 NA https://en.wikipedia.org/wiki/Treherne_(South_Norfolk_Airpark) TN6
298405 CWG2 heliport Winnipeg (City of Winnipeg) Heliport 49.90047 -97.09555 763 NA CA CA-MB Winnipeg FALSE CWG2 NA CWG2 NA NA NA
1662 CYAV medium_airport Winnipeg / St. Andrews Airport 50.05640 -97.03250 760 NA CA CA-MB Winnipeg FALSE CYAV NA NA NA https://en.wikipedia.org/wiki/Winnipeg/St._Andrews_Airport YAV
1664 CYAX medium_airport Lac Du Bonnet Airport 50.29440 -96.01000 850 NA CA CA-MB Lac Du Bonnet TRUE CYAX NA NA NA https://en.wikipedia.org/wiki/Lac_du_Bonnet_Airport YAX
1677 CYBQ medium_airport Tadoule Lake Airport 58.70610 -98.51220 923 NA CA CA-MB Tadoule Lake TRUE CYBQ XTL NA NA https://en.wikipedia.org/wiki/Tadoule_Lake_Airport YBQ
1678 CYBR medium_airport Brandon Municipal Airport 49.91000 -99.95190 1343 NA CA CA-MB Brandon TRUE CYBR YBR NA NA https://en.wikipedia.org/wiki/Brandon_Airport NA
1679 CYBT medium_airport Brochet Airport 57.88940 -101.67900 1136 NA CA CA-MB Brochet TRUE CYBT YBT NA NA https://en.wikipedia.org/wiki/Brochet_Airport NA
1681 CYBV medium_airport Berens River Airport 52.35890 -97.01830 728 NA CA CA-MB Berens River TRUE CYBV YBV NA NA https://en.wikipedia.org/wiki/Berens_River_Airport NA
1696 CYCR medium_airport Cross Lake (Charlie Sinclair Memorial) Airport 54.61060 -97.76080 709 NA CA CA-MB Cross Lake FALSE CYCR YCR NA NA https://en.wikipedia.org/wiki/Cross_Lake_(Charlie_Sinclair_Memorial)_Airport NA
1710 CYDN medium_airport Dauphin Barker Airport 51.10080 -100.05200 999 NA CA CA-MB Dauphin TRUE CYDN YDN NA NA https://en.wikipedia.org/wiki/Dauphin_(Lt._Col_W.G._(Billy)_Barker_VC_Airport) NA
1735 CYFO medium_airport Flin Flon Airport 54.67810 -101.68200 997 NA CA CA-MB Flin Flon TRUE CYFO YFO NA NA https://en.wikipedia.org/wiki/Flin_Flon_Airport NA
1745 CYGM medium_airport Gimli Industrial Park Airport 50.62810 -97.04330 753 NA CA CA-MB Gimli FALSE CYGM YGM NA NA https://en.wikipedia.org/wiki/Gimli_Industrial_Park_Airport NA
1746 CYGO medium_airport Gods Lake Narrows Airport 54.55890 -94.49140 617 NA CA CA-MB Gods Lake Narrows TRUE CYGO YGO NA NA https://en.wikipedia.org/wiki/Gods_Lake_Narrows_Airport NA
1753 CYGX medium_airport Gillam Airport 56.35750 -94.71060 476 NA CA CA-MB Gillam TRUE CYGX YGX NA NA https://en.wikipedia.org/wiki/Gillam_Airport NA
1776 CYIV medium_airport Island Lake Airport 53.85720 -94.65360 770 NA CA CA-MB Island Lake TRUE CYIV YIV NA NA https://en.wikipedia.org/wiki/Island_Lake_Airport NA
1805 CYLR medium_airport Leaf Rapids Airport 56.51330 -99.98530 959 NA CA CA-MB Leaf Rapids FALSE CYLR YLR NA NA https://en.wikipedia.org/wiki/Leaf_Rapids_Airport NA
1825 CYNE medium_airport Norway House Airport 53.95830 -97.84420 734 NA CA CA-MB Norway House TRUE CYNE YNE NA NA https://en.wikipedia.org/wiki/Norway_House_Airport NA
1830 CYNN medium_airport Nejanilini Lake Airport 59.48750 -97.78030 1000 NA CA CA-MB Nejanilini Lake FALSE CYNN NA NA NA https://en.wikipedia.org/wiki/Nejanilini_Lake_Airport NA
1835 CYOH medium_airport Oxford House Airport 54.93330 -95.27890 663 NA CA CA-MB Oxford House TRUE CYOH YOH NA NA https://en.wikipedia.org/wiki/Oxford_House_Airport NA
1846 CYPG medium_airport Southport Airport 49.90310 -98.27382 885 NA CA CA-MB Portage la Prairie FALSE CYPG YPG NA http://southport.ca/ https://en.wikipedia.org/wiki/Portage_La_Prairie/Southport_Airport NA
1865 CYQD medium_airport The Pas Airport 53.97140 -101.09100 887 NA CA CA-MB The Pas TRUE CYQD YQD NA NA https://en.wikipedia.org/wiki/The_Pas_Airport NA
1894 CYRS medium_airport Red Sucker Lake Airport 54.16720 -93.55720 729 NA CA CA-MB Red Sucker Lake FALSE CYRS YRS NA NA https://en.wikipedia.org/wiki/Red_Sucker_Lake_Airport NA
1912 CYST medium_airport St. Theresa Point Airport 53.84560 -94.85190 773 NA CA CA-MB St. Theresa Point TRUE CYST YST NA NA https://en.wikipedia.org/wiki/St._Theresa_Point_Airport NA
1920 CYTH medium_airport Thompson Airport 55.80110 -97.86420 729 NA CA CA-MB Thompson TRUE CYTH YTH NA NA https://en.wikipedia.org/wiki/Thompson_Airport NA
1934 CYVD medium_airport Virden/R.J. (Bob) Andrew Field Regional Aerodrome 49.87830 -100.91800 1454 NA CA CA-MB Virden FALSE CYVD NA YVD NA https://en.wikipedia.org/wiki/Virden_Airport NA
1946 CYWG large_airport Winnipeg / James Armstrong Richardson International Airport 49.91000 -97.23990 783 NA CA CA-MB Winnipeg TRUE CYWG YWG YWG http://www.waa.ca/ https://en.wikipedia.org/wiki/Winnipeg_James_Armstrong_Richardson_International_Airport CFB Winnipeg
1980 CYYL medium_airport Lynn Lake Airport 56.86390 -101.07600 1170 NA CA CA-MB Lynn Lake TRUE CYYL YYL NA NA https://en.wikipedia.org/wiki/Lynn_Lake_Airport NA
1984 CYYQ medium_airport Churchill Airport 58.73920 -94.06500 94 NA CA CA-MB Churchill TRUE CYYQ YYQ NA NA https://en.wikipedia.org/wiki/Churchill_Airport NA
2005 CZAC medium_airport York Landing Airport 56.08940 -96.08920 621 NA CA CA-MB York Landing TRUE CZAC ZAC NA NA https://en.wikipedia.org/wiki/York_Landing_Airport NA
2009 CZBD medium_airport Ilford Airport 56.06140 -95.61390 642 NA CA CA-MB Ilford TRUE CZBD ILF NA NA https://en.wikipedia.org/wiki/Ilford_Airport ZBD
2012 CZEE medium_airport Kelsey Airport 56.03750 -96.50970 600 NA CA CA-MB Kelsey FALSE CZEE KES ZEE NA https://en.wikipedia.org/wiki/Kelsey_Airport NA
2016 CZFG medium_airport Pukatawagan Airport 55.74920 -101.26600 958 NA CA CA-MB Pukatawagan FALSE CZFG XPK ZFG NA https://en.wikipedia.org/wiki/Pukatawagan_Airport NA
2020 CZGI medium_airport Gods River Airport 54.83970 -94.07860 627 NA CA CA-MB Gods River TRUE CZGI ZGI NA NA https://en.wikipedia.org/wiki/Gods_River_Airport NA
2021 CZGR medium_airport Little Grand Rapids Airport 52.04560 -95.46580 1005 NA CA CA-MB Little Grand Rapids FALSE CZGR ZGR NA NA https://en.wikipedia.org/wiki/Little_Grand_Rapids_Airport NA
2023 CZJG medium_airport Jenpeg Airport 54.51890 -98.04610 729 NA CA CA-MB Jenpeg FALSE CZJG ZJG NA NA https://en.wikipedia.org/wiki/Jenpeg_Airport NA
2024 CZJN medium_airport Swan River Airport 52.12060 -101.23600 1100 NA CA CA-MB Swan River TRUE CZJN ZJN NA NA https://en.wikipedia.org/wiki/Swan_River_Airport NA
2026 CZLQ medium_airport Thicket Portage Airport 55.31890 -97.70780 678 NA CA CA-MB Thicket Portage FALSE CZLQ YTD NA NA https://en.wikipedia.org/wiki/Thicket_Portage_Airport ZLQ
2029 CZMN medium_airport Pikwitonei Airport 55.58890 -97.16420 630 NA CA CA-MB Pikwitonei FALSE CZMN PIW NA NA https://en.wikipedia.org/wiki/Pikwitonei_Airport ZMN
2031 CZNG medium_airport Poplar River Airport 52.99653 -97.27419 728 NA CA CA-MB Poplar River FALSE CZNG XPP NA NA https://en.wikipedia.org/wiki/Poplar_River_Airport NA
2038 CZSN medium_airport South Indian Lake Airport 56.79280 -98.90720 951 NA CA CA-MB South Indian Lake FALSE CZSN XSI ZSN NA https://en.wikipedia.org/wiki/South_Indian_Lake_Airport NA
2040 CZTA small_airport Bloodvein River Airport 51.78457 -96.69231 721 NA CA CA-MB Bloodvein River FALSE CZTA YDV ZTA NA https://en.wikipedia.org/wiki/Bloodvein_River_Airport ZTA
2041 CZTM medium_airport Shamattawa Airport 55.86560 -92.08140 289 NA CA CA-MB Shamattawa TRUE CZTM ZTM NA NA https://en.wikipedia.org/wiki/Shamattawa_Airport NA
2045 CZWH medium_airport Lac Brochet Airport 58.61750 -101.46900 1211 NA CA CA-MB Lac Brochet FALSE CZWH XLB ZWH NA https://en.wikipedia.org/wiki/Lac_Brochet_Airport NA

Data wrangling remark

Note that there is an alternative to dplyr (the package that allows us to use the pipe %>%); it is indeed possible to treat data frames as SQL tables and run SQL queries on them. This may make more sense to some of you. For illustration, to create the table of movements, I used the following command (which can run, since it is not destructive of what we have already done).

query = "SELECT orig,dest,SUM(vol) AS vol
FROM air_travel_MB
GROUP BY orig,dest
ORDER BY orig,dest"
air_travel_MB = sqldf::sqldf(query)

Finish preparing the data: the following code (chunk not shown) adds the latitude and longitudes of all the airports in the air_travel_MB data set. Note that we give RoW a location: we will show it as an additional vertex in the graph. (I picked somewhere in Ontario, close to but not in Manitoba.)

IATA lon lat
RoW -90.0000 49.5000
XLB -101.4690 58.6175
XSI -98.9072 56.7928
XTL -98.5122 58.7061
YBR -99.9519 49.9100
YBT -101.6790 57.8894

We are now in a position to make the graph and plot it in simple form. We add the volume as the weight of the arcs.

We also make a subgraph without RoW to focus on the properties really specific to Manitoba.

Making nicer plots

Before we explore the properties of the graph, let us spend a little time on visualisation. This is not to be neglected: nice plots help more than you think.

The next piece of code does the following:

That box around the plot is a little distracting, let’s remove it.

Let us add the degree information as the size of the vertices. First, on the graph with rest of the world connection information..

Then on the “purely MB” graph.

So clearly, Winnipeg (YWG) and Thompson (YTH) have the highest degree. Let us confirm this by looking at the degree distribution.

## YWG YTH ZGI YGO YOH YRS YFO YQD ZTM YIV XLB XTL YBR YCR YDN YGX YNE YYQ YST XSI 
##  34  28  10   8   8   8   6   6   6   5   4   4   4   4   4   4   4   4   3   2 
## YBT YBV ZAC 
##   2   2   2

So, within the MB graph, Winnipeg dwarfs all other vertices in terms of connections to other locations. Note this is the degree in the underlying undirected graph, if we choose an orientation, we get a slightly different picture.

## YWG YTH ZGI YGO YOH YRS YFO YIV YQD ZTM XLB XTL YBR YCR YDN YGX YNE YYQ XSI YBT 
##  17  14   5   4   4   4   3   3   3   3   2   2   2   2   2   2   2   2   1   1 
## YBV YST ZAC 
##   1   1   1
## YWG YTH ZGI YGO YOH YRS YFO YQD ZTM XLB XTL YBR YCR YDN YGX YIV YNE YST YYQ XSI 
##  17  14   5   4   4   4   3   3   3   2   2   2   2   2   2   2   2   2   2   1 
## YBT YBV ZAC 
##   1   1   1

It looks like the degree is usually the same regardless of whether we consider in- or out-degree. The only 2 airports that have different in- and out-degree are rdiff_d`, that is, Island Lake Airport, St. Theresa Point Airport.

Now let us take a look at the arcs. Maybe change their thickness to reflect the volumes along the arcs?

My guess: some of the arcs are so massive that this is all we can see. So let us renormalise the values of the weights. First, what do they look like now?

##   [1]     18     47     48     48     50     98     99    114    116    174
##  [11]    176    208    208    212    242    276    278    279    288    288
##  [21]    288    292    292    309    337    337    343    344    364    366
##  [31]    368    369    372    383    399    401    401    406    447    447
##  [41]    449    451    451    462    529    565    567    582    592    644
##  [51]    650    652    652    682    684    694    696    701    702    713
##  [61]    714    758    766    780    806    848    854   1036   1050   1167
##  [71]   1172   1242   1270   1279   1342   1349   1394   1462   1464   1474
##  [81]   1485   1543   1565   1607   1638   1750   1857   2002   2230   2518
##  [91]   2582   2877   2899   2910   2924   3037   3157   3355   3355   3365
## [101]   4246   4571   5770   5789   7430  11464 157323 183256

So, yes, clearly a bit too much variation. If we scale linearly by multiplying by a constant, we will most likely lose the information on the small weights. Just to check that we are intuiting correctly, though, let us try once doing this.

What we suspected, indeed: to make the arcs with the largest volume not too large, we had to essentially get rid of the weight of the arcs with small volumes. So what we want to do is to process the values through a function that would make the smaller values larger relative to the larger ones or the larger values closer to the smaller one, then scale the result. For this, it is good to look at what the values look like.

One way around this could be to use a so-called sigmoid function. This is a function of the following form: \[ f(y) = \dfrac{1}{1+e^{-cy}}, \] where \(\mathbb{R}\ni c>0\) is a parameter. This function has the following properties: \(\lim_{y\to-\infty}f(y)=0\), \(\lim_{y\to\infty}f(y)=1\) and \(f(0)=1/2\). By playing with the value of \(c\), one can set the beahviour of \(f\). Let us transform the values of the arc weights using such a function, testing how different values of \(c\) influence the value of the points. Because we are only transforming positive values, let us work with the positive half of the sigmoid.

In the plot below, the red points are the original values, unscaled, while the different colours are the transformed values. (The viridis palette used starts with yellow and goes towards green and then purple.)

Somewhere between the last two looks quite nice. Let’s dig a bit more around, see if we can be a bit better. We can use a genetic algorithm to find the value of \(c\) that makes the transformed values as close as possible to a line from the minimum \((x_m,y_m)\) to the maximum value \((x_M,y_M)\). The line has equation \[ y = \frac{y_M - y_m}{x_M - x_m}(x - x_m) + y_m \] To do this, we define an error function that we want to minimise and run the genetic algorithm, as shown below.

error_transformation = function(data_x, data_y, c) {
  x_m = min(data_x)
  x_M = max(data_x)
  y = 1 / (x_M - x_m) * (data_x - x_m)
  transformed_y = sigmoid(data_y, c)
  error = sum((transformed_y-y)^2)
  return(error)
}
GA = ga(type = "real-valued", 
        fitness = 
          function(x) -error_transformation(values_x, 
                                            values_y, 
                                            x),
        lower = c(100),
        upper = c(1000),
        suggestions = c(150))
values_c = as.numeric(GA@solution)

We find a value of \(c\simeq\) 274.85. Using this value, the transformed values take the form below.

We most likely will have to multiply by a factor, so we compute the values in advance.

Well, after all this, I am not convinced we achieved better than we had done above with just a linear scaling. So when we want a a good plot, we’ll come back to that solution.

Central points, centre, periphery

For simplicity, I only show the out-degree case. And just to show how easily it’s done: let’s colour the vertices in the centre red and those in the periphery blue.

## Central points:
##  [1] "YFO" "YGO" "YGX" "YOH" "YQD" "YTH" "YWG" "YYQ" "ZGI" "ZTM"
## Periphery:
##  [1] "XLB" "XSI" "XTL" "YBR" "YBT" "YBV" "YCR" "YDN" "YIV" "YNE" "YRS" "YST"
## [13] "ZAC"

Girth

Recall that girth in igraph assumes the graph is undirected.

## $girth
## [1] 3
## 
## $circle
## + 3/24 vertices, named, from 8a68143:
## [1] XLB RoW XTL
## $girth
## [1] 3
## 
## $circle
## + 3/23 vertices, named, from c4fe14c:
## [1] XTL XLB YTH

Density

What fraction of possible arcs/edges are present?

## [1] 0.1956522
## [1] 0.1600791

Cliques

## Warning in largest_cliques(G_MB): At
## vendor/cigraph/src/cliques/maximal_cliques_template.h:219 : Edge directions are
## ignored for maximal clique calculation.
## [[1]]
## + 5/23 vertices, named, from c4fe14c:
## [1] ZGI YGO YWG YTH YOH

Centrality

Degree-centrality

## XLB XSI XTL YBR YBT YBV YCR YDN YFO YGO YGX YIV YNE YOH YQD YRS YST YTH YWG YYQ 
##   2   1   2   2   1   1   2   2   3   4   2   2   2   4   3   4   2  14  17   2 
## ZAC ZGI ZTM 
##   1   5   3
## XLB XSI XTL YBR YBT YBV YCR YDN YFO YGO YGX YIV YNE YOH YQD YRS YST YTH YWG YYQ 
##   2   1   2   2   1   1   2   2   3   4   2   3   2   4   3   4   1  14  17   2 
## ZAC ZGI ZTM 
##   1   5   3
## XLB XSI XTL YBR YBT YBV YCR YDN YFO YGO YGX YIV YNE YOH YQD YRS YST YTH YWG YYQ 
##   4   2   4   4   2   2   4   4   6   8   4   5   4   8   6   8   3  28  34   4 
## ZAC ZGI ZTM 
##   2  10   6

K-nearest neighbours

For info, the return values of the function knn are - knn: A numeric vector giving the average nearest neighbor degree for all vertices in vids. - knnk: A numeric vector, its length is the maximum (total) vertex degree in the graph. The first element is the average nearest neighbor degree of vertices with degree one, etc.

## $knn
##       XLB       XSI       XTL       YBR       YBT       YBV       YCR       YDN 
## 16.000000 28.000000 16.000000 19.000000 28.000000 34.000000 19.000000 19.000000 
##       YFO       YGO       YGX       YIV       YNE       YOH       YQD       YRS 
## 22.666667 20.000000 31.000000 17.400000 19.000000 20.000000 22.666667 13.750000 
##       YST       YTH       YWG       YYQ       ZAC       ZGI       ZTM 
## 24.333333  7.142857  6.705882 31.000000 28.000000 17.200000 23.333333 
## 
## $knnk
##  [1]       NaN 29.500000 24.333333 21.250000 17.400000 22.888889       NaN
##  [8] 17.916667       NaN 17.200000       NaN       NaN       NaN       NaN
## [15]       NaN       NaN       NaN       NaN       NaN       NaN       NaN
## [22]       NaN       NaN       NaN       NaN       NaN       NaN  7.142857
## [29]       NaN       NaN       NaN       NaN       NaN  6.705882
## $knn
##       XLB       XSI       XTL       YBR       YBT       YBV       YCR       YDN 
## 16.000000 28.000000 16.000000 19.000000 28.000000 34.000000 19.000000 19.000000 
##       YFO       YGO       YGX       YIV       YNE       YOH       YQD       YRS 
## 22.666667 20.000000 31.000000 15.000000 19.000000 20.000000 22.666667 13.750000 
##       YST       YTH       YWG       YYQ       ZAC       ZGI       ZTM 
## 34.000000  7.142857  6.705882 31.000000 28.000000 17.200000 23.333333 
## 
## $knnk
##  [1] 30.400000 21.250000 20.916667 17.916667 17.200000       NaN       NaN
##  [8]       NaN       NaN       NaN       NaN       NaN       NaN  7.142857
## [15]       NaN       NaN  6.705882
## $knn
##       XLB       XSI       XTL       YBR       YBT       YBV       YCR       YDN 
## 16.000000 28.000000 16.000000 19.000000 28.000000 34.000000 19.000000 19.000000 
##       YFO       YGO       YGX       YIV       YNE       YOH       YQD       YRS 
## 22.666667 20.000000 31.000000 21.000000 19.000000 20.000000 22.666667 13.750000 
##       YST       YTH       YWG       YYQ       ZAC       ZGI       ZTM 
## 19.500000  7.142857  6.705882 31.000000 28.000000 17.200000 23.333333 
## 
## $knnk
##  [1] 29.500000 21.050000 22.888889 17.916667 17.200000       NaN       NaN
##  [8]       NaN       NaN       NaN       NaN       NaN       NaN  7.142857
## [15]       NaN       NaN  6.705882

Let us plot the values in the graph, say, for the in-knn.

Coreness

## XLB XSI XTL YBR YBT YBV YCR YDN YFO YGO YGX YIV YNE YOH YQD YRS YST YTH YWG YYQ 
##   4   2   4   4   2   2   4   4   6   8   4   4   4   8   6   6   3   8   8   4 
## ZAC ZGI ZTM 
##   2   8   6
## XLB XSI XTL YBR YBT YBV YCR YDN YFO YGO YGX YIV YNE YOH YQD YRS YST YTH YWG YYQ 
##   2   1   2   2   1   1   2   2   3   4   2   2   2   4   3   3   1   4   4   2 
## ZAC ZGI ZTM 
##   1   4   3
## XLB XSI XTL YBR YBT YBV YCR YDN YFO YGO YGX YIV YNE YOH YQD YRS YST YTH YWG YYQ 
##   2   1   2   2   1   1   2   2   3   4   2   2   2   4   3   3   2   4   4   2 
## ZAC ZGI ZTM 
##   1   4   3

Let us look at the out-coreness, for instance, and colour the vertices as a function of that.

Betweenness

##        RoW        XLB        XSI        XTL        YBR        YBT        YBV 
##  63.416667   0.000000   0.000000   0.000000   2.166667   0.000000   0.000000 
##        YCR        YDN        YFO        YGO        YGX        YIV        YNE 
##   0.000000   0.000000   0.000000   0.000000   0.000000   0.500000   0.000000 
##        YOH        YQD        YRS        YST        YTH        YWG        YYQ 
##   0.000000   0.000000   2.666667   0.000000 191.916667 250.166667   0.000000 
##        ZAC        ZGI        ZTM 
##   0.000000   5.083333   3.083333
##        XLB        XSI        XTL        YBR        YBT        YBV        YCR 
##   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000 
##        YDN        YFO        YGO        YGX        YIV        YNE        YOH 
##   0.000000   0.000000   0.000000   0.000000   0.500000   0.000000   0.000000 
##        YQD        YRS        YST        YTH        YWG        YYQ        ZAC 
##   0.000000   2.666667   0.000000 211.666667 280.166667   0.000000   0.000000 
##        ZGI        ZTM 
##   6.000000   4.000000

Closeness

First, the unweighted case, i.e., using the geodesic distance.

##     XLB     XSI     XTL     YBR     YBT     YBV     YCR     YDN     YFO     YGO 
## 0.02000 0.01961 0.02000 0.02128 0.01961 0.02083 0.02128 0.02128 0.02439 0.02500 
##     YGX     YIV     YNE     YOH     YQD     YRS     YST     YTH     YWG     YYQ 
## 0.02381 0.02174 0.02128 0.02500 0.02439 0.02222 0.02128 0.03333 0.03704 0.02381 
##     ZAC     ZGI     ZTM 
## 0.01961 0.02564 0.02439
##     XLB     XSI     XTL     YBR     YBT     YBV     YCR     YDN     YFO     YGO 
## 0.02000 0.01961 0.02000 0.02128 0.01961 0.02083 0.02128 0.02128 0.02439 0.02500 
##     YGX     YIV     YNE     YOH     YQD     YRS     YST     YTH     YWG     YYQ 
## 0.02381 0.02174 0.02128 0.02500 0.02439 0.02222 0.02083 0.03333 0.03704 0.02381 
##     ZAC     ZGI     ZTM 
## 0.01961 0.02564 0.02439
##     XLB     XSI     XTL     YBR     YBT     YBV     YCR     YDN     YFO     YGO 
## 0.02000 0.01961 0.02000 0.02128 0.01961 0.02083 0.02128 0.02128 0.02439 0.02500 
##     YGX     YIV     YNE     YOH     YQD     YRS     YST     YTH     YWG     YYQ 
## 0.02381 0.02128 0.02128 0.02500 0.02439 0.02222 0.02128 0.03333 0.03704 0.02381 
##     ZAC     ZGI     ZTM 
## 0.01961 0.02564 0.02439

We can also compute closeness using weighted arcs, i.e., using the travel volumes. Geodesic distance shown for comparison. We save the results for future manipulation.

##        XLB        XSI        XTL        YBR        YBT        YBV        YCR 
## 0.02000000 0.01960784 0.02000000 0.02127660 0.01960784 0.02083333 0.02127660 
##        YDN        YFO        YGO        YGX        YIV        YNE        YOH 
## 0.02127660 0.02439024 0.02500000 0.02380952 0.02127660 0.02127660 0.02500000 
##        YQD        YRS        YST        YTH        YWG        YYQ        ZAC 
## 0.02439024 0.02222222 0.02127660 0.03333333 0.03703704 0.02380952 0.01960784 
##        ZGI        ZTM 
## 0.02564103 0.02439024
##          XLB          XSI          XTL          YBR          YBT          YBV 
## 3.556061e-05 4.171882e-05 3.788453e-05 4.025603e-05 3.989150e-05 2.928172e-05 
##          YCR          YDN          YFO          YGO          YGX          YIV 
## 3.762935e-05 3.726893e-05 3.605163e-05 5.860634e-05 2.420721e-05 3.335557e-05 
##          YNE          YOH          YQD          YRS          YST          YTH 
## 2.986323e-05 6.466632e-05 4.283206e-05 5.351887e-05 2.247494e-05 6.413134e-05 
##          YWG          YYQ          ZAC          ZGI          ZTM 
## 5.218934e-05 4.675738e-05 4.381353e-05 6.568576e-05 5.549390e-05

To prepare for plots, let us look at the ranges of values.

## [1] 0.01960784 0.03703704

## [1] 2.247494e-05 6.568576e-05

So if we multiply the first values by 10,000 and the second ones by 1e7, we should get good ranges of variation.

## [1] 196.0784 370.3704
## [1] 224.7494 656.8576

Indeed, so that’s what we do.

One interesting remark here: closeness radically changes when considering the unweighted and weighted version. Just to confirm this, let us plot the two graphs side by side.

So Thompson (YTH) is has higher closeness centrality than Winnipeg (YWG) when passenger volumes are considered. Does the situation change if we recall that Winnipeg is quite connected to the rest of the world? We prepare the computations and the plots as we had done earlier.

## [1] 0.01960784 0.03571429
## [1] 2.144864e-05 6.247267e-05

Ranges are quite similar to those earlier, so we can probably just do the same as before. We will plot the 4 figures this time. First row is as before, second row is with rest of the world information thrown in.

Actually, things do not change, except that RoW becomes important as well.